package com.hava.spring_data.repository;

import com.hava.spring_data.entity.BigUser;
import com.hava.spring_data.entity.User;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * Created by yanfa on 2016/10/26.
 */
public interface MyBatisDao {

    @Select("SELECT * FROM user WHERE first_name= #{firstName}")
    public User findOne(String firstName);

    @Select("SELECT * FROM user")
    public List<User> findAll();

    @Results({
        @Result(property = "id",column = "id"),
        @Result(property = "firstName",column = "first_name"),
        @Result(property = "lastName",column = "last_name"),
    })
    @Select("SELECT * FROM user")
    public List<BigUser> getUserList();
}
